package com.famdoc.Pojo.params;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.temporal.TemporalAdjuster;
import java.time.temporal.TemporalAdjusters;
import java.util.List;

/**
 * 首页工作提醒数据库查询参数类
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class IndexBodyParams {

    private Integer doctorId; //医生id
    private String crowdName; //人群分类名
    private LocalDateTime startOfDay; //今天的开始时间
    private LocalDateTime endOfDay; //今天的结束时间
    private LocalDateTime startOfWeek; //这周开始的时间
    private LocalDateTime endOfWeek; //这周结束的时间
    private LocalDateTime now; //当前时间
    private Integer start; //开始下标
    private Integer pageSize; //页大小

    public IndexBodyParams(Integer doctorId){
        this.doctorId = doctorId;
        this.startOfDay = LocalDateTime.of(LocalDate.now(), LocalTime.MIN);
        this.endOfDay = LocalDateTime.of(LocalDate.now(), LocalTime.MAX);
        LocalDateTime startOfWeek = LocalDateTime.now().with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY));
        this.startOfWeek = LocalDateTime.of(startOfWeek.toLocalDate(),LocalTime.MIN);
        this.endOfWeek = LocalDateTime.of(startOfWeek.plusDays(6).toLocalDate(),LocalTime.MAX);
        this.now = LocalDateTime.now();
    }
}
